<script type="text/javascript" src="<?php echo CON_STATIC_URL; ?>zhsjr/js/My97DatePicker/WdatePicker.js"></script>
<?php ?>
<!-- 会员中心账户信息 -->
<div class="newtitle-box">
  <div class="newtitle w">
  <!-- 
       <span class="invlist_title">您现在的位置：
       <?php if($sub_1 != ""){?>
       		<a href="<?php echo $sub_1_href?>"><?php echo $sub_1;?></a>>
       <?php }?>
       <?php  if($sub_2 != ""){?>
        	<a href="<?php echo $sub_2_href?>"><?php echo $sub_2;?></a>>
       <?php }?>
      
      	<?php  if($sub_3 != ""){?>
        	<a href="<?php echo $sub_3_href?>"><?php echo $sub_3;?></a>>
       <?php }?>
       
    </span >
     -->
    <div class="member_body rg">	
		<?php 
	    	if(isset($hdata1['user']['user_id'])){?>
	    		  	    	欢迎 &nbsp;&nbsp;<a href="/user/zhs_center.html"><em class="red" style="font-size:15px"><?php echo $hdata1['user']['username'];?></em></a>
	    	<a href="/user/logout">&nbsp;&nbsp;注销</a>
	   	  	<?php }else {?>
             <a class="in_reg" href="/reg.html"></a>
	     	 <a class="in_login" href="/login.html"></a> 	 
	      <?php }?>
	 </div>  
  </div>
</div>
<!---->
<div class="membanner_box">
  <?php
		$CI = & get_instance();
		$CI->load->model('header_model');
		$hdata = $CI->header_model->getUserAcnt();
	?>
  <div class="memban_bd w">
    <dl class="mebban_left">
      <dd>
        <div><img src='/static/images/user_pic.png'></div>
        <div class="mebban_info">         
          <a class="meaa" href="/user/zhs_info/contact.html"></a>
          <a href="/user/zhs_info/contact.html">编辑资料</a>        
        </div>
      </dd>
      <dt>		
		    <?php if(isset($hdata['user_acnt']['user_id'])){?>
        <ul class="mebban_ul">
          <li style="border:none; padding-left:0px;">账户总额<br><?php echo number_format($hdata['user_acnt']['total'],2);?> 元
          <li>理财资产<br><?php echo number_format($hdata['user_acnt']['invite_total'],2);?>元</li>
          <li>账户余额<br><?php echo number_format($hdata['user_acnt']['use_money'],2);?>元</li>
          <li>冻结资金<br><?php echo number_format($hdata['user_acnt']['no_use_money'],2);?>元</li>
          <li>应收收益<br><?php echo number_format($hdata['user_acnt']['income_total'],2);?>元</li>
          <!--<li>代金券余额<br><?php echo number_format($hdata['user_acnt']['red_money'],2);?></li>-->
          <li>累计收益<br><?php echo number_format($hdata['borrow_tender']['alinterest']+$hdata['borrow_tender']['allinter'],2);?>元</li>
        </ul> 
        <?php }?>
      </dt>
    </dl>    
    <div class="mebban_right">
      <font color="#666">您的专属客服</font><br>
      <?php if($hdata['kefu']['src']){?>
      <a href="<?php echo $hdata['kefu']['src']?>" onclick="user_click_kefu()" target="_blank">
        <img src="<?php echo $hdata['kefu']['img']?>" title="点击咨询我">
      </a>
      <br><font color="#666"><?php echo $hdata['kefu']['kf_name']?></font>
      <?php }else{ ?>
      <a id='set_kefu'>
        <img src="<?php echo $hdata['kefu']['img']?>" title="设置您的专属客服">
      </a>
      <br><font color="#666">设置专属客服</font>
      <?php } ?>      
      <div></div>
    </div> 
    <style>
      .set_kefu{
        display:none;
      }
      .submit1{
        height: 25px;
        line-height:25px;
        border: 1px solid #fec92a;
        display:block;
        text-align: center;
        background-color:#fec92a; 
        color:#fff;
      }
    </style>
    <div class='set_kefu'>
      <form name='form_kefu'>
        <div>
          <input name="mykefu" type="radio" value="1" checked="checked" /><img src="/static/ydd/image/kf_ff.png">客服-范范
        </div>
        <div>
          <input name="mykefu" type="radio" value="2" /><img src="/static/ydd/image/kf_xr.png">客服-七七
        </div>
        <div>
          <input name="mykefu" type="radio" value="3" /><img src="/static/ydd/image/kf_lh.png">客服-小小
        </div>
        <div>
          <input name="mykefu" type="radio" value="4" /><img src="/static/ydd/image/kf_ph.png">客服-投投
        </div><br>
        <div class='submit1' onclick="set_user_kefu()">提交</div>
      </form>
    </div>
<script type="text/javascript">

//设置专属客服弹出框
$(function(){
  $('#set_kefu').click(function(){
    $(".set_kefu").dialog({
      bgiframe: true,
        resizable: false,
        height:480,
        width:400,
        title:"设置您的专属客服",
    })
  })
})

//记录用户点击
function user_click_kefu(){
  $.ajax({
    type:"post",
    url:"/user/user_click_kefu",
    data:{kefu:'1'},
    dataType:"text",
    success:function(data){
      console.log(data);
    },
    error:function(data){
      console.log('点击失败');
    }
  });
}

//设置专属客服
function set_user_kefu(){
  var kefu=document.getElementsByName("mykefu");
  var kefuno='';
  for (var i =0; i<kefu.length;i++) {
    if(kefu[i].checked){
        kefuno=kefu[i].value;
    }
  };
  $.ajax({
    type:"post",
    url:"/user/set_user_kefu",
    data:{kefu:kefuno},
    dataType:"text",
    success:function(data){
      alert(data);
    },
    error:function(data){
      alert('提交失败，请重新提交');
    }
  });
  $('.set_kefu').dialog('close');
}
</script>
  </div>
</div>
